From: kyte Date: Sat, 27 Nov 2021 07:50:23 +0000 (+0530) Subject: lockScreen: Don't wake up screen in DND mode X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~536^2^2~28 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=920714008c1eb04e5d757de6c249c57defbd8fa3;p=gnome-shell.git lockScreen: Don't wake up screen in DND mode Screen woke up whenever a new notification popped up on lock screen even when DND was turned on. This commit changes this behaviour to not wake the screen up in such case. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4710 Part-of: --- diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js index 3ef6aa90f..367117bfd 100644 --- a/js/ui/unlockDialog.js +++ b/js/ui/unlockDialog.js @@ -46,6 +46,10 @@ var NotificationsBox = GObject.registerClass({ this.add_child(this._scrollView); + this._settings = new Gio.Settings({ + schema_id: 'org.gnome.desktop.notifications', + }); + this._sources = new Map(); Main.messageTray.getSources().forEach(source => { this._sourceAdded(Main.messageTray, source, true); @@ -176,6 +180,14 @@ var NotificationsBox = GObject.registerClass({ this._updateSourceBoxStyle(source, obj, box); } + _wakeUpScreenForSource(source) { + if (!this._settings.get_boolean('show-banners')) + return; + const obj = this._sources.get(source); + if (obj?.sourceBox.visible) + this.emit('wake-up-screen'); + } + _sourceAdded(tray, source, initial) { let obj = { visible: source.policy.showInLockScreen, @@ -235,8 +247,7 @@ var NotificationsBox = GObject.registerClass({ }); this._updateVisibility(); - if (obj.sourceBox.visible) - this.emit('wake-up-screen'); + this._wakeUpScreenForSource(source); } } @@ -268,8 +279,7 @@ var NotificationsBox = GObject.registerClass({ obj.sourceBox.visible = obj.visible && (source.unseenCount > 0); this._updateVisibility(); - if (obj.sourceBox.visible) - this.emit('wake-up-screen'); + this._wakeUpScreenForSource(source); } _visibleChanged(source, obj) { @@ -280,8 +290,7 @@ var NotificationsBox = GObject.registerClass({ obj.sourceBox.visible = obj.visible && source.unseenCount > 0; this._updateVisibility(); - if (obj.sourceBox.visible) - this.emit('wake-up-screen'); + this._wakeUpScreenForSource(source); } _detailedChanged(source, obj) {